Add our own setMSecsSinceEpoch() in gpsbabel::DateTime()
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 11 Jun 2014 04:08:27 +0000 (04:08 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 11 Jun 2014 04:08:27 +0000 (04:08 +0000)
gpsbabel/src/core/datetime.h

index 55051ae0b43ee9f7651da4f17fb7528afe5cc960..d79096865c57c03f110821898d84879e5d58b32d 100644 (file)
@@ -94,6 +94,14 @@ public:
     return -msecsTo(epoch);
   }
 
+  // This was added in Qt 4.7, but it's easy enough to knock out here.
+  void setMSecsSinceEpoch(qint64 msecs) {
+    int ddays = msecs / 86400000;
+    msecs %= 86400000;
+    setDate(QDate(1970, 1, 1).addDays(ddays));
+    setTime(QTime(0,0).addMSecs(msecs));
+  }
+
   // Like toString, but with subsecond time that's included only when
   // the trailing digits aren't .000.  Always UTC.
   QString toPrettyString() const {